package com.zfl.thread.day04;

import java.util.ArrayList;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList;

public class CollectionSecurityDemo06 {
    public static void main(String[] args) {

//        ArrayList<String> list = new ArrayList<>();

        CopyOnWriteArrayList<String> list = new CopyOnWriteArrayList<>(new ArrayList<>());
        for (int i = 0; i < 50; i++) {
            new Thread(() -> {
                list.add(UUID.randomUUID().toString().substring(0, 4));
                System.out.println(list);
            }).start();
        }
    }


}
